package org.example.admin.controller;

import io.swagger.annotations.Api;
import org.example.admin.service.AdminWxUserService;
import org.example.common.utils.ResponseUtil;
import org.example.db.entity.WxUser;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
@Api(tags = "对微信用户的操作")
public class AdminWxUserController {

    AdminWxUserService wxUserService;

    public AdminWxUserController(AdminWxUserService wxUserService) {
        this.wxUserService = wxUserService;
    }

    @GetMapping("/detail")
    public Object getWxUser(){
        List<WxUser> wxUserList = wxUserService.getWxUserList();
        return ResponseUtil.ok(wxUserList);
    }

    @PostMapping("/update")
    public Object updateWxUser(@RequestBody WxUser wxUser){
        if(wxUserService.updateWxUser(wxUser)==1){
            return ResponseUtil.ok();
        }
        return ResponseUtil.fail();
    }

    @GetMapping("/footprint/list")
    public Object getFootPrint(){
        return ResponseUtil.ok(wxUserService.getFootPrintList());
    }

    @GetMapping("/collect/list")
    public Object getCollect(){
        return ResponseUtil.ok(wxUserService.getCollectList());
    }

}
